home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993…ch: Other People's Memory / ADC Developer CD (1993-03) (''Other People's Memory'')_iso / Dev.CD Mar 93.iso / Development Platforms / CSMP Digests / csmp-v1-004.txt < prev    next >
Encoding:
Text File  |  1992-11-18  |  58.9 KB  |  1,602 lines  |  [TEXT/MPS ]

  1. C.S.M.P. Digest             Sun, 08 Mar 92       Volume 1 : Issue 4
  2.  
  3. Today's Topics:
  4.  
  5.     CTB tool resource access
  6.     Question on useritems in dialogs
  7.     Regions
  8.     gambit scheme interpreter
  9.     C++ for mac (for beginner)
  10.     Standard UI question regarding tool pallettes.
  11.     moving resources from point A to point B?
  12.     Status of MacTutor
  13.     drawing dash lines in QuickDraw...
  14.     Finding all mounted volumes
  15.     68040 caches, why do programs break?
  16.  
  17.  
  18. The Comp.Sys.Mac.Programmer Digest is moderated by Michael A. Kelly.
  19.  
  20. These digests are available (by using FTP, account anonymous, your email
  21. address as password) in the pub/mac directory on ftp.cs.uoregon.edu.
  22. This is also the home of the comp.sys.mac.programmer Frequently Asked
  23. Questions list.
  24.  
  25. The articles in these digests are taken directly from comp.sys.mac.programmer.
  26. They are not edited; all articles included in this digest are in their original
  27. posted form.  The only articles that are -not- included in these digests are
  28. those which didn't receive any replies (except those that give information
  29. rather than ask a question).  All replies to each article are concatenated
  30. onto the original article in the order in which they were received.  Article
  31. threads are not added to the digests until the last article added to the
  32. thread is at least one month old (this is to ensure that the thread is dead
  33. before adding it to the digests).
  34.  
  35. Send administrative mail to mkelly@cs.uoregon.edu.
  36.  
  37. -------------------------------------------------------
  38.  
  39. From: asunta@convex.csc.FI (Miika Asunta)
  40. Subject: CTB tool resource access
  41. Date: 26 Jan 92 10:32:07 GMT
  42. Organization: Finnish Academic and Research Network Project - FUNET
  43.  
  44. There is one missing piece of documentation in Inside Comm TB.
  45.  
  46.     HOW DO I ACCESS RESOURCES?
  47.     HOW DO I AVOID CONFLICTS WITH TERMINAL APP'S RESOURCES?
  48.  
  49. Communications Resource Manager defines few routines, which are helpful
  50. but how to access DLOGs and ALERTs with routines
  51.  
  52. GetNewDialog()
  53. Alert()
  54.  
  55.  
  56. Chapter 'Writing Connection tools' gives a following hint in a code sample
  57.  
  58. {
  59. int oldresfile=CurResFile();
  60. UseResFile((**Transfer).procID);
  61. // access resources here
  62. UseResFile(oldresfile);
  63. }
  64.  
  65. Which doesn't feel like best solution.
  66. And, nothing is said in the documentation.
  67.  
  68. Do CRMRealToLocalID and CRMLocalToRealID check possible conflicts?
  69.  
  70. And, why ctb source code samples are not in ftp.apple.com?
  71.  
  72. Miika
  73.  
  74.  
  75. --
  76. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  77. &  Miika Asunta        &  asunta@convex.csc.fi  &  Double Bass Player   &
  78. & tel. +358-0-494 093  &             &  Macintosh Programmer &
  79. &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
  80.  
  81.  
  82.  
  83. - -------------------------
  84.  
  85. From: leonardr@ccs.itd.umich.edu
  86. Subject:  CTB tool resource access
  87. Date: 26 Jan 92 19:06:37 GMT
  88. Organization: Campus Computing Sites, University of Michigan-Ann Arbor
  89.  
  90. In article <1992Jan26.103207.13095@nic.funet.fi> asunta@convex.csc.FI (Miika Asunta) writes:
  91. >There is one missing piece of documentation in Inside Comm TB.
  92. >
  93. >    HOW DO I ACCESS RESOURCES?
  94. >    HOW DO I AVOID CONFLICTS WITH TERMINAL APP'S RESOURCES?
  95. >
  96. >Chapter 'Writing Connection tools' gives a following hint in a code sample
  97. >
  98. >{
  99. >int oldresfile=CurResFile();
  100. >UseResFile((**Transfer).procID);
  101. >// access resources here
  102. >UseResFile(oldresfile);
  103. >}
  104. >
  105. >Which doesn't feel like best solution.
  106. >
  107.     Believe it or not, that is the correct solution!  That will give you
  108. access to your resources, and you should NEVER have to worry about conflicting
  109. with application resources since the tool's resource map goes into the chain
  110. BEHIND the System - so there is a LOT of stuff that a GetResource call would
  111. find first on a normal search.
  112.  
  113. >And, nothing is said in the documentation.
  114. >
  115.     What else is new ;-)
  116.  
  117.  
  118. -- 
  119. - ---------------------------------------------------------------------
  120. Leonard Rosenthol          Internet: leonardr@ccs.itd.umich.edu
  121. Director of Advanced Technology   AppleLink: MACgician
  122. Aladdin Systems, inc.          GEnie:     MACgician
  123.  
  124.  
  125.  
  126. ---------------------------
  127.  
  128. From: yeongm2@aix.rpi.edu (Mengyik Yeong)
  129. Subject: Question on useritems in dialogs
  130. Date: 26 Jan 92 18:25:18 GMT
  131.  
  132. I am trying to write a dialog routine with a userItem, but am having some 
  133. trouble with it.  Any help would be greatly appreciated.
  134.  
  135. I installed my useritem procedure with calls to the GetDItem and SetDItem
  136. functions.  My useritem function is called from ModalDialog and does what
  137. it is supposed to do.  However, the program hangs upon exiting from my
  138. useritem function.  In addition, although the userItem function is called,
  139. the 'theItem' parameter which is passed is wrong, ie not what is passed
  140. by SetDItem.  I had assumed originally that the useritem procedure would
  141. be called by the ShowWindow routine, since that is what displays the dialog
  142. items.  Why is it called by ModalDialog?  I would really appreciate any
  143. help on this matter.  Do I need to write a custom filterProc routine?
  144. My userItem function only does some custom drawing to the dialog box and does
  145. not take any input from the user.
  146.  
  147. Thanks in anticipation
  148.  
  149. Mengyik
  150. yeongm2@rpi.edu
  151.  
  152.  
  153.  
  154. - -------------------------
  155.  
  156. From: stevec@Apple.COM (Steve Christensen)
  157. Subject:  Question on useritems in dialogs
  158. Date: 28 Jan 92 01:20:03 GMT
  159. Organization: Apple Computer Inc., Cupertino, CA
  160.  
  161. yeongm2@aix.rpi.edu (Mengyik Yeong) writes:
  162. >I am trying to write a dialog routine with a userItem, but am having some 
  163. >trouble with it.  Any help would be greatly appreciated.
  164.  
  165. >I installed my useritem procedure with calls to the GetDItem and SetDItem
  166. >functions.  My useritem function is called from ModalDialog and does what
  167. >it is supposed to do.  However, the program hangs upon exiting from my
  168. >useritem function.  In addition, although the userItem function is called,
  169. >the 'theItem' parameter which is passed is wrong, ie not what is passed
  170. >by SetDItem.  I had assumed originally that the useritem procedure would
  171. >be called by the ShowWindow routine, since that is what displays the dialog
  172. >items.  Why is it called by ModalDialog?  I would really appreciate any
  173. >help on this matter.  Do I need to write a custom filterProc routine?
  174. >My userItem function only does some custom drawing to the dialog box and does
  175. >not take any input from the user.
  176.  
  177. First make sure that you installed your userItem correctly.  The code should
  178. look something like this:
  179.  
  180.     GetDItem(theDialog,theItem,&theType,&theHandle,&theRect);
  181.     SetDItem(theDialog,theItem,theType,(ProcPtr)&DrawUserItem);
  182.  
  183. where DrawUserItem is defined as:
  184.  
  185.     pascal void DrawUserItem(DialogPtr theDialog, short theItem)
  186.  
  187. Assuming your drawing code doesn't do anything weird, the above should work.
  188.  
  189. You are mistaken about when the drawing takes place.  ShowWindow does not draw
  190. the contents of your window; it simply makes your window visible (if it was
  191. previously invisible).  ModalDialog will cause your window's contents to be
  192. drawn (or re-drawn) in response to an update event generated when your window
  193. requires an update.  You don't need a special filterProc to handle the
  194. drawing, since filterProcs _typically_ are used for filtering events...
  195.  
  196. steve
  197. -- 
  198. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  199.   Steve Christensen            Never hit a man with glasses.
  200.   stevec@apple.com            Hit him with a baseball bat.
  201.  
  202.  
  203.  
  204. - -------------------------
  205.  
  206. From: yeongm2@aix.rpi.edu (Mengyik Yeong)
  207. Subject:  Question on useritems in dialogs
  208. Date: 28 Jan 92 15:14:04 GMT
  209.  
  210. Thanks to all who responded to my question. Turns out my mistake was
  211. I did not declare my userItem function as a pascal function.
  212.  
  213. Mengyik
  214.  
  215.  
  216.  
  217. - -------------------------
  218.  
  219. From: smoke@well.sf.ca.us (Nicholas Jackiw)
  220. Subject:  Question on useritems in dialogs
  221. Date: 30 Jan 92 19:04:05 GMT
  222. Organization: Whole Earth 'Lectronic Link, Sausalito, CA
  223.  
  224. In article <t46rgfb@rpi.edu> yeongm2@aix.rpi.edu (Mengyik Yeong) writes:
  225. >
  226. >I installed my useritem procedure with calls to the GetDItem and SetDItem
  227. >functions.  My useritem function is called from ModalDialog and does what
  228. >it is supposed to do.  However, the program hangs upon exiting from my
  229. >useritem function.  In addition, although the userItem function is called,
  230. >the 'theItem' parameter which is passed is wrong, ie not what is passed
  231. >by SetDItem.  I had assumed originally that the useritem procedure would
  232. >be called by the ShowWindow routine, since that is what displays the dialog
  233. >items.  Why is it called by ModalDialog?  I would really appreciate any
  234. >help on this matter.  Do I need to write a custom filterProc routine?
  235. >My userItem function only does some custom drawing to the dialog box and does
  236. >not take any input from the user.
  237.  
  238. You should post your code to clarify what's going wrong with your
  239. GetDItem/SetDItem (i. e. why theItem is incorrect on invocation of
  240. your userProc.
  241.  
  242. As to why it's called by ModalDialog instead of ShowWindow, understand
  243. that ShowWindow draws only the window structure (i. e. frame, titlebar).
  244. The contents of the window are added to the window's updateRgn, which is
  245. then reported as non-empty by an updateEvent.  ModalDialog, which is a
  246. private GetNextEvent loop, receives the update event and calls DrawDialog.
  247. DrawDialog iterates through your items and, upon realizing that your
  248. user item intersects the update region, calls your user item proc.  On the
  249. other hand, if theItem is incorrect, then it's not looking at your user
  250. item at all, but at some other item.  Posting your code will help us 
  251. figure out why.
  252.  
  253.  
  254. -- 
  255.                               --- * ---
  256. Nick Jackiw                  Smoke@well.sf.ca.us   | Jackiw@cs.swarthmore.edu
  257. Key Curriculum Press, Inc.   Applelink:KEY.EDUSOFT | (415) 548-2304
  258.                               --- * ---
  259.  
  260.  
  261.  
  262. ---------------------------
  263.  
  264. From: IO92143@MAINE.MAINE.EDU (Donna Foster)
  265. Subject: Regions
  266. Date: 26 Jan 92 19:48:50 GMT
  267. Organization: University of Maine System
  268.  
  269. My SO asked me to pass on this query. He's defining a game board with ~60
  270. hexagons so that he can use PtInRgn (?) to find where the user clicked.
  271. However, this seems to be a huge memory hog. Can anyone confirm this? Also,
  272. is there any way in ThinkC to keep track of current memory allocation? If
  273. not, this might be nice for a future release.... TIA :-)
  274.  
  275.  
  276.  
  277. - -------------------------
  278.  
  279. From: smoke@well.sf.ca.us (Nicholas Jackiw)
  280. Subject:  Regions
  281. Date: 30 Jan 92 19:21:08 GMT
  282. Organization: Whole Earth 'Lectronic Link, Sausalito, CA
  283.  
  284. In article <92026.144850IO92143@MAINE.MAINE.EDU> IO92143@MAINE.MAINE.EDU (Donna Foster) writes:
  285. >My SO asked me to pass on this query. He's defining a game board with ~60
  286. >hexagons so that he can use PtInRgn (?) to find where the user clicked.
  287. >However, this seems to be a huge memory hog. Can anyone confirm this? Also,
  288. >is there any way in ThinkC to keep track of current memory allocation? If
  289. >not, this might be nice for a future release.... TIA :-)
  290.  
  291. "To keep track of current memory allocation"
  292.  
  293. What do you mean, exactly?  You might try looking at FreeMem in the
  294. memory manager, if you're simply after a byteCount of available space.
  295.  
  296. Re Regions
  297.  
  298. GROSSLY INEFFICIENT:
  299.  
  300. 60 regions, identical (congruent) in form, situated at different origins.
  301.  
  302. INEFFICIENT:
  303.  
  304. 1 region describing a canonical hexagon.  Use OffsetRgn to move it to
  305. origin#x (0<x<~60) before checking if PtInRgn(myPt,CanonicalRgn) is true.
  306. If it is, myPt is in hexagon #x.
  307.  
  308. Efficient because OffsetRgn is very fast; most of a region is origin-relative,
  309. and OffsetRgn just moves the origin.
  310.  
  311. Inefficient because regions' structure is designed to best accomodate 
  312. unions of overlapping rectangles in standard orientation (e. g. a bunch
  313. of overlapping windows).  Hexagons, which must include some diagonal
  314. lines, are very difficult to describe by overlapping rectangles.
  315.  
  316. MOST EFFICIENT:
  317.  
  318. Exploit any symmetries in your board and answer the question arithmetically.
  319. If your hexes are regular, you should be able to devise a simple integer
  320. expression to determine point inclusion.  Better, if your hexes are laid in
  321. a regular grid, think of that grid as the intersection of three perfectly
  322. square grids (at 120 angles to each other), which can be solved by straight
  323. division.
  324.  
  325.  
  326. -- 
  327.                               --- * ---
  328. Nick Jackiw                  Smoke@well.sf.ca.us   | Jackiw@cs.swarthmore.edu
  329. Key Curriculum Press, Inc.   Applelink:KEY.EDUSOFT | (415) 548-2304
  330.                               --- * ---
  331.  
  332.  
  333.  
  334. - -------------------------
  335.  
  336. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  337. Subject:  Regions
  338. Date: 1 Feb 92 06:14:33 GMT
  339. Organization: University of Waikato, Hamilton, New Zealand
  340.  
  341. In article <29746@well.sf.ca.us>, smoke@well.sf.ca.us (Nicholas Jackiw) writes:
  342.  
  343. > INEFFICIENT:
  344. >
  345. > 1 region describing a canonical hexagon.  Use OffsetRgn to move it to
  346. > origin#x (0<x<~60) before checking if PtInRgn(myPt,CanonicalRgn) is true.
  347. > If it is, myPt is in hexagon #x.
  348. >
  349. > Efficient because OffsetRgn is very fast; most of a region is origin-relative,
  350. > and OffsetRgn just moves the origin.
  351.  
  352. No it isn't. I know IM1 (or something official from way back) says that a
  353. region is origin-relative, but it most certainly is not. OffsetRgn really
  354. does require modifying every point coordinate in the region structure.
  355.  
  356. A full description of the QuickDraw region structure can be found in Ted
  357. Cohn's article in MacTutor from a couple or so years back (drat, I forget
  358. the exact issue).
  359.  
  360. > Inefficient because regions' structure is designed to best accomodate
  361. > unions of overlapping rectangles in standard orientation (e. g. a bunch
  362. > of overlapping windows).  Hexagons, which must include some diagonal
  363. > lines, are very difficult to describe by overlapping rectangles.
  364.  
  365. Damn right.
  366.  
  367. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  368. Computer Services Dept                     fax: +64-7-838-4066
  369. University of Waikato            electric mail: ldo@waikato.ac.nz
  370. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  371. X Windows: distributed computing in reverse.
  372.  
  373.  
  374.  
  375. - -------------------------
  376.  
  377. From: timm@void.ncsa.uiuc.edu (Globulator)
  378. Subject:  Regions
  379. Date: 31 Jan 92 05:52:20 GMT
  380. Organization: University of Illinois at Urbana
  381.  
  382. ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  383.  
  384. >No it isn't. I know IM1 (or something official from way back) says that a
  385. >region is origin-relative, but it most certainly is not. OffsetRgn really
  386. >does require modifying every point coordinate in the region structure.
  387.  
  388. Say it ain't so!  Hmmm...how can this be, seeing as a QuickDraw region
  389. is just a set of inversion points, defined from whatever rgnBBox.topLeft
  390. is?  No point information...just inversion information.  Or is what I
  391. understand the region definition to be completely flawed?
  392. -- 
  393. Tim McClarren (timm@ncsa.uiuc.edu)|"I'm countin' down to the day deservin'
  394. Mac Programmer  (217)244-0015     | Fittin' for a king  I'm waitin' for the
  395. NCSA/STG@University of Illinois   | time when I can Get to Arizona" PE Apoc 91
  396.  
  397.  
  398.  
  399. - -------------------------
  400.  
  401. From: christer@cs.umu.se (Christer Ericson)
  402. Subject:  Regions
  403. Date: 31 Jan 92 16:11:34 GMT
  404. Organization: Dep. of Info.Proc, Umea Univ., Sweden
  405.  
  406. In <1992Jan31.055220.21082@ux1.cso.uiuc.edu> timm@void.ncsa.uiuc.edu (Globulator) writes:
  407.  
  408. >ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  409.  
  410. >>No it isn't. I know IM1 (or something official from way back) says that a
  411. >>region is origin-relative, but it most certainly is not. OffsetRgn really
  412. >>does require modifying every point coordinate in the region structure.
  413. >
  414. >Say it ain't so!  Hmmm...how can this be, seeing as a QuickDraw region
  415. >is just a set of inversion points, defined from whatever rgnBBox.topLeft
  416. >is?  No point information...just inversion information.  Or is what I
  417. >understand the region definition to be completely flawed?
  418.  
  419. No, only somewhat flawed. Regions are handled in two cases, rectangular
  420. and not rectangular. If a region is rectangular it will only consist
  421. of the size (being ten) and the rect itself. If not, the rect will
  422. be followed by the inversion point data. This is organized in scanlines
  423. of the format (XXXX and YYYY are words)
  424.  
  425. YYYY XXXX XXXX .... XXXX XXXX  7FFF
  426. YYYY ....
  427. 7FFF
  428.  
  429. These are not in any way related to the bounding rect, so OffsetRgn
  430. will have to update every point in the region, which can be seen from
  431. inspecting the code. Inspecting the code will also reveal something
  432. else, which might or might not be obvious; that in a non rectangular
  433. region there must be at least one scanline, and that the x coordinates
  434. of the scanline always come in pairs.
  435.  
  436. For those not familiar with reading ROM code, I've appended it below
  437. with some annotations of mine. It is really short, and since everyone
  438. will be able to find it in their own ROM using Macsbug I hope
  439. Apples lawyers won't jump on me for including it. IMHO, it is an
  440. excellent piece of code to learn the region format from.
  441.  
  442.   _OfsetRgn
  443.      +0000  408361E0   MOVEA.L    (A7)+,A1    ;fetch return address
  444.      +0002  408361E2   MOVE.W     (A7)+,D1    ;and dv
  445.      +0004  408361E4   MOVE.W     (A7)+,D0    ;and dh
  446.      +0006  408361E6   MOVEA.L    (A7)+,A0    ;and pointer to rgn
  447.      +0008  408361E8   MOVEA.L    (A0),A0
  448.      +000A  408361EA   ADDQ.W     #$2,A0    ;skip rgnSize
  449.      +000C  408361EC   ADD.W      D1,(A0)+    ;now offset rgnBBox
  450.      +000E  408361EE   ADD.W      D0,(A0)+    ;using dv & dh
  451.      +0010  408361F0   ADD.W      D1,(A0)+
  452.      +0012  408361F2   ADD.W      D0,(A0)+
  453.      +0014  408361F4   CMPI.W     #$000A,-$000A(A0);is rgn rectangular?
  454.      +001A  408361FA   BEQ.S      _OfsetRgn+0030;yes, we're done
  455.      +001C  408361FC   ADD.W      D1,(A0)+    ;update y coord
  456.      +001E  408361FE   ADD.W      D0,(A0)+    ;update pair of
  457.      +0020  40836200   ADD.W      D0,(A0)+    ;x coord inversion points
  458.      +0022  40836202   CMPI.W     #$7FFF,(A0)    ;repeat for all inversion
  459.      +0026  40836206   BNE.S      _OfsetRgn+001E;points of scanline
  460.      +0028  40836208   ADDQ.W     #$2,A0
  461.      +002A  4083620A   CMPI.W     #$7FFF,(A0)    ;repeat for all
  462.      +002E  4083620E   BNE.S      _OfsetRgn+001C;rows in rgn
  463.      +0030  40836210   JMP        (A1)        ;return to caller
  464.  
  465.  
  466. Christer Ericson --- Internet: christer@cs.umu.se --- tel: +46-90-166794
  467. Department of Computer Science, University of Umea, S-90187 UMEA, SWEDEN
  468.  
  469.  
  470.  
  471. - -------------------------
  472.  
  473. From: jess@gn.ecn.purdue.edu (Jess M Holle)
  474. Subject:  Regions
  475. Date: 31 Jan 92 20:38:24 GMT
  476. Organization: Purdue University Engineering Computer Network
  477.  
  478. Another idea for checking whether a point is in a polygon, in general, assuming
  479. that you have convex polygon is:
  480.  
  481. Take the dot product (using integer math) of
  482.   - the vector from each polygon point to the next
  483. and 
  484.   - the vector from each polygon point to the mouse click location 
  485.  
  486. By examining the signs of these dot products, you can decide whether the
  487. point is in or out of the polygon.  Quick rejection should be applied so
  488. that if the point is found to be outside of the polygon on the first test,
  489. it skips out of the check loop immediately.  With a little optimization
  490. for your polygons and a quick check to find which polygons are even worth
  491. checking (for example, if the polygons all fit within a 20 pixel rectangle,
  492. only check polygons known to be close enough to the pick point), this routine
  493. should be relatively quick.
  494.  
  495. This was probably already been obvious.  For this application, one of the other
  496. techniques mentioned may work better, I'm just throwing out an idea.
  497.  
  498. Jess Holle
  499.  
  500.  
  501.  
  502. - -------------------------
  503.  
  504. From: mullerd@prism.CS.ORST.EDU (Douglas Muller)
  505. Subject:  Regions
  506. Date: 1 Feb 92 02:51:04 GMT
  507. Organization: Oregon State University, Computer Science Dept.
  508.  
  509. Instead of offsetting the region why don't you offset the point
  510. in the opposite directions?
  511.  
  512. Am I missing something?
  513.  
  514. mullerd@prism.cs.orst.edu
  515.  
  516. If I could afford my own .sig you would see it here!
  517.  
  518.  
  519.  
  520. - -------------------------
  521.  
  522. From: greggor@Apple.COM (Greg L. Anderson)
  523. Subject:  Regions
  524. Date: 31 Jan 92 21:17:49 GMT
  525. Organization: Apple Computer Inc., Cupertino, CA
  526.  
  527. >ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
  528. >>No it isn't. I know IM1 (or something official from way back) says that a
  529. >>region is origin-relative, but it most certainly is not. OffsetRgn really
  530. >>does require modifying every point coordinate in the region structure.
  531.  
  532. In article <1992Jan31.055220.21082@ux1.cso.uiuc.edu> timm@void.ncsa.uiuc.edu (Globulator) writes:
  533. >Say it ain't so!
  534.  
  535. It's so.
  536.  
  537. >Hmmm...how can this be, seeing as a QuickDraw region
  538. >is just a set of inversion points, defined from whatever rgnBBox.topLeft
  539. >is?  No point information...just inversion information.  Or is what I
  540. >understand the region definition to be completely flawed?
  541.  
  542. Quickdraw regions are sets of inversion points all right, but the
  543. points are specified in quickdraw-space, not relative to any part
  544. of the bounding box.
  545. -- 
  546. =====================   ===========================   =====================
  547. Greg Anderson           Apple Computer, Inc.            O    Ponnuki    O
  548. Macintosh Bodhisattva   Developer Tools Engineering    O O  is  ideal  O O
  549. greggor@apple.com       Apple Developer Suite           O     shape     O
  550. =====================   ===========================   =====================
  551.  
  552.  
  553.  
  554. ---------------------------
  555.  
  556. From: ll438143@LANCE.ColoState.Edu (wonko the sane)
  557. Subject: gambit scheme interpreter
  558. Date: 27 Jan 92 01:31:59 GMT
  559. Organization: Colorado State U. Engineering College
  560.  
  561.  
  562.   I was wondering if anyone out there had played with the Gambit scheme
  563.   interpreter v1.7.  I am having real problems even getting it to add two
  564.   numbers together.  Is there any trick to getting it to read the input?
  565.   I spent about two hours with it and I got 3*5 to work once by accident
  566.   and never did figure out how I did it.  
  567.  
  568.   Any help would be appreciated!
  569.  
  570.               -------> Larry Loesch <-------
  571.  
  572.               ll438143@longs.lance.colostate.edu 
  573.  
  574.  
  575.  
  576. - -------------------------
  577.  
  578. From: zkessin@chaos.cs.brandeis.edu (Zach Kessin)
  579. Subject:  gambit scheme interpreter
  580. Date: 27 Jan 92 03:18:05 GMT
  581. Organization: Brandeis University
  582.  
  583. ll438143@LANCE.ColoState.Edu (wonko the sane) writes:
  584.  
  585.  
  586. >  I was wondering if anyone out there had played with the Gambit scheme
  587. >  interpreter v1.7.  I am having real problems even getting it to add two
  588. >  numbers together.  Is there any trick to getting it to read the input?
  589. >  I spent about two hours with it and I got 3*5 to work once by accident
  590. >  and never did figure out how I did it.  
  591.  
  592. >  Any help would be appreciated!
  593.  
  594. >              -------> Larry Loesch <-------
  595.  
  596. >              ll438143@longs.lance.colostate.edu 
  597.  
  598. You nead to hit the <enter> key (on the keypad) to send something to
  599. the interpreter. if you do that even in the editor window it will
  600. work.
  601.  
  602. ==>(+ 3 5) <enter>
  603. 8
  604.  
  605. --Zach
  606.  
  607.    Zachary Kessin                /  recursive: adj, see recursive
  608.  ZKessin@chaos.cs.brandeis.edu  / 
  609.  Kessin@brandeis (BITNET)      /    I have not lost my mind:      
  610.  (617)736-5878                /       I have a tape backup somewhere
  611.  
  612.  
  613.  
  614. - -------------------------
  615.  
  616. From: plogan@mentorg.com (Patrick Logan)
  617. Subject:  gambit scheme interpreter
  618. Date: 27 Jan 92 20:21:34 GMT
  619. Organization: Mentor Graphics Corporation
  620.  
  621. In article <1992Jan27.013159.46081@yuma.acns.colostate.edu> ll438143@LANCE.ColoState.Edu (wonko the sane) writes:
  622.      I was wondering if anyone out there had played with the Gambit scheme
  623.      interpreter v1.7.  I am having real problems even getting it to add two
  624.      numbers together.  Is there any trick to getting it to read the input?
  625.      I spent about two hours with it and I got 3*5 to work once by accident
  626.      and never did figure out how I did it.  
  627.  
  628.      Any help would be appreciated!
  629.  
  630. Read the "read me first" (or similarly named file). Place the text
  631. cursor behind the expression to be evaluated then type the <enter>
  632. key.
  633.  
  634. <newline> will advance the text cursor to a new line following the
  635. current line. <enter> will evaluate the expression preceding the text
  636. cursor.
  637.  
  638. -- 
  639. Patrick Logan, plogan@mentorg.com,
  640. Voice: (503) 685-7000 x2907, FAX: (503) 685-1282
  641. Mentor Graphics Corp., Bldg. C, 8005 SW Boeckman Rd., Wilsonville, OR 97070
  642. I can't gete the .signature virus and I can't gete the .signature
  643.  
  644.  
  645.  
  646. ---------------------------
  647.  
  648. From: zkessin@chaos.cs.brandeis.edu (Zach Kessin)
  649. Subject: C++ for mac (for beginner)
  650. Date: 27 Jan 92 01:11:37 GMT
  651. Organization: Brandeis University
  652.  
  653. I am looking to learn C++ and I am trying to figure out which c++
  654. would be best. please consider both price and features
  655.  
  656. thanks
  657.  
  658. --Zach
  659.  
  660.    Zachary Kessin                /  recursive: adj, see recursive
  661.  ZKessin@chaos.cs.brandeis.edu  / 
  662.  Kessin@brandeis (BITNET)      /    I have not lost my mind:      
  663.  (617)736-5878                /       I have a tape backup somewhere
  664.  
  665.  
  666.  
  667. - -------------------------
  668.  
  669. From: bear@bucsf.bu.edu (Blair M. Burtan)
  670. Subject:  C++ for mac (for beginner)
  671. Date: 27 Jan 92 22:44:34 GMT
  672. Organization: Boston U. College of Engineering
  673.  
  674. >From what I can tell, MPW is the only full-blown C++ out there.
  675.  
  676. Now here's a really good question/request:
  677.  
  678.    Could someone (i.e. Apple) please write a version
  679.    of Inside Macintosh with C prototypes?  Having learned
  680.    Mac programming in Pascal, I need to know the equivalents in C.
  681.    I have torn my hair out many times trying to figure out
  682.    whether something should be a pointer or not and mundane things
  683.    like what is the equivalent to Str255.  EEEEEEEEEEEEEK!!!!!!
  684.  
  685.    We now return you to your regularly scheduled news reader...
  686. --
  687. +---------------------------------------+
  688. + "If it isn't Baroque, don't fix it."  +
  689. +               - Beauty and The Beast  +
  690. +                        +
  691. + Blair M. Burtan: bear@bucsf.bu.edu    +
  692. +                  bear@bu-pub.bu.edu   +
  693. +---------------------------------------+
  694.  
  695.  
  696.  
  697. ---------------------------
  698.  
  699. From: ptrubey@netcom.COM (Phil Trubey)
  700. Subject: Standard UI question regarding tool pallettes.
  701. Date: 27 Jan 92 06:11:29 GMT
  702. Organization: Netcom - Online Communication Services  (408 241-9760 guest)
  703.  
  704. When an application has a floating tool palette (like the one in MacPaint),
  705. the tool selected can be global for all open documents, or its state can
  706. change depending which document is active.  I've seen different applications
  707. implement this in the two different ways.  MacPaint, for instance, has the
  708. tool palette selection global to the entire application so that if you
  709. click on the font tool while operating on one document, clicking on another
  710. document will keep the font tool selected.
  711.  
  712. Other applications do it the other way round and keep track of which
  713. tool is selected for each open document.
  714.  
  715. The current font type and style are other examples of things that can be global
  716. to the application or just global to the open documents.
  717.  
  718. My question is:  is there a standard for which way to design your application?
  719. Or do the Apple UI police ( :-) ) not care?
  720.  
  721. -- 
  722. Phil Trubey                   | ptrubey@netcom.com
  723. Systemhouse Inc.              | 415-243-8100 (day)
  724.  
  725.  
  726.  
  727. - -------------------------
  728.  
  729. From: mlanett@void.ncsa.uiuc.edu (Mark Lanett)
  730. Subject:  Standard UI question regarding tool pallettes.
  731. Date: 27 Jan 92 14:59:28 GMT
  732. Organization: University of Illinois at Urbana
  733.  
  734. ptrubey@netcom.COM (Phil Trubey) writes:
  735.  
  736. >When an application has a floating tool palette (like the one in MacPaint),
  737. >the tool selected can be global for all open documents, or its state can
  738. >change depending which document is active.  I've seen different applications
  739. >implement this in the two different ways.  MacPaint, for instance, has the
  740. >tool palette selection global to the entire application so that if you
  741. >click on the font tool while operating on one document, clicking on another
  742. >document will keep the font tool selected.
  743.  
  744. If you play with ResEdit for a while you'll quickly get annoyed by it's use
  745. of separate tool palettes. In my program each kind of document shares the
  746. tool palette, but there are still 3 kind of documents/tool palettes. I'm goinf
  747. to change it so that the contents of a single tool palette always show what's
  748. appropriate for the document.
  749. -- 
  750. Mark Lanett                                                   mlanett@uiuc.edu
  751. Software Tools Group, NCSA, University of Illinois at Urbana-Champaign
  752.  
  753.  
  754.  
  755. - -------------------------
  756.  
  757. From: ericd@CATICSUF.CSUFRESNO.EDU (Eric W. Douglas)
  758. Subject:  Standard UI question regarding tool pallettes.
  759. Date: 27 Jan 92 14:37:38 GMT
  760.  
  761.  
  762. ptrubey@netcom.COM (Phil Trubey) writes:
  763.  
  764. >When an application has a floating tool palette (like the one in MacPaint),
  765. >the tool selected can be global for all open documents, or its state can
  766. >change depending which document is active.  I've seen different applications
  767. >implement this in the two different ways.  MacPaint, for instance, has the
  768. >tool palette selection global to the entire application so that if you
  769. >click on the font tool while operating on one document, clicking on another
  770. >document will keep the font tool selected.
  771.  
  772. >Other applications do it the other way round and keep track of which
  773. >tool is selected for each open document.
  774.  
  775. >The current font type and style are other examples of things that can be global
  776. >to the application or just global to the open documents.
  777.  
  778. >My question is:  is there a standard for which way to design your application?
  779. >Or do the Apple UI police ( :-) ) not care?
  780.  
  781. I would say there is no defacto fashion for implementation, since apple 
  782. officially doesn't tell programmer's how to implement tool palletes.
  783.  
  784. IMO, the "user intuitiveness" of the palettes which identify with whatever
  785. window is currently active are much better. One point which you must be 
  786. aware of though, are instances where a user will do a clipboard operation
  787. on one layer, then paste the selection into another layer. In this instance,
  788. the current tool in the destination layer should switch to whatever tool
  789. is appopriate for the operation. In the case of the clipboard, it would
  790. probably be the pointer tool, so that the user may move around the pasted
  791. object.
  792.  
  793. --eric
  794.  
  795. * | Eric W. Douglas             Technojock               +1 209 897 5785 | *
  796. * | I'net: ericd@caticsuf.csufresno.edu      ericd@csufres.csufresno.edu | *
  797. * | AppleLink: STUDIO.D      Compuserve: 76170,1472       AOL: EWDOUGLAS | *
  798. ____________________________________________________________________________
  799.  
  800.  
  801.  
  802. ---------------------------
  803.  
  804. From: rsherman@mthvax.cs.miami.edu (Roby Sherman)
  805. Subject: moving resources from point A to point B?
  806. Date: 27 Jan 92 14:08:29 GMT
  807. Organization: The Tao of Programming
  808.  
  809. Hi.
  810.  
  811.    I'm working on a program that will open the resource of a file and modify
  812.    it's resources (ICONS, SND, etc) I was wondering what would be the BEST
  813.    method for copying the resources from one to the other... I have two
  814.    scenarios that I've looked at :
  815.  
  816.    1> Load Resource A, Load Resource B copy contents of handle A to Handle
  817.    B, Call CHANGEDRESOURCE on handle B, WriteResource B
  818.  
  819.  
  820.    2>Remove resource B, Load Resource A, Add Resource A to RESFILE B.
  821.  
  822.    Any ideas on how I can do this better?
  823.  
  824.  
  825.       --Roby
  826. -- 
  827. rsherman@mthvax.cs.miami.edu                    Roby Sherman
  828.  
  829.  
  830.  
  831. - -------------------------
  832.  
  833. From: russotto@eng.umd.edu (Matthew T. Russotto)
  834. Subject:  moving resources from point A to point B?
  835. Date: 27 Jan 92 15:41:39 GMT
  836. Organization: University of Maryland, College Park, College of Engineering
  837.  
  838. In article <ko84itINNjad@mthvax.cs.miami.edu> rsherman@mthvax.cs.miami.edu (Roby Sherman) writes:
  839. >Hi.
  840. >
  841. >   I'm working on a program that will open the resource of a file and modify
  842. >   it's resources (ICONS, SND, etc) I was wondering what would be the BEST
  843. >   method for copying the resources from one to the other... I have two
  844. >   scenarios that I've looked at :
  845. >
  846. >   1> Load Resource A, Load Resource B copy contents of handle A to Handle
  847. >   B, Call CHANGEDRESOURCE on handle B, WriteResource B
  848. >
  849. >
  850. >   2>Remove resource B, Load Resource A, Add Resource A to RESFILE B.
  851. >
  852. >   Any ideas on how I can do this better?
  853.  
  854. I believe scenario 1> is preferable, as scenario 2> involves everything
  855. scenario 1> involves, plus unnecessary change to the resource map.
  856.  
  857.  
  858. -- 
  859. Matthew T. Russotto    russotto@eng.umd.edu    russotto@wam.umd.edu
  860. Your superior intellect is no match for our puny weapons! -- The Simpsons
  861. Just say NO to police searches and seizures.  Make them use force.
  862. (not responsible for bodily harm resulting from following above advice)
  863.  
  864.  
  865.  
  866. ---------------------------
  867.  
  868. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  869. Subject: Status of MacTutor
  870. Date: 27 Jan 92 23:32:59 GMT
  871. Organization: University of Waikato, Hamilton, New Zealand
  872.  
  873. You may recall my posting a week or two back reporting subscription problems
  874. with MacTutor magazine, and asking if anyone else had been having similar
  875. troubles.
  876.  
  877. Thanks to all those who replied via e-mail with information about the
  878. change of ownership and contact information. I thought I'd post a summary
  879. of developments, for those who are curious.
  880.  
  881. The story is, MacTutor have been acquired by Xplain Corp. Here's a copy
  882. of the press release that was sent to me:
  883.  
  884. ****
  885. News Release -- For Immediate Release
  886.  
  887. Los Angeles, California, January 11th, 1992 -- Xplain Corporation today
  888. announced that it has acquired MacTutor Company.  For more than 7 years,
  889. MacTutor Company has published MacTutor Magazine -- The Macintosh Programming
  890. Journal.  For more than 5 years, Xplain's principles have specialized in
  891. software development, technical writing and software sales.
  892.  
  893. Xplain will be moving the magazine from it's Anaheim, California location to
  894. West Los Angeles, California.  To accomodate moving and acquisition activities
  895. as well as changes in the magazine, MacTutor is taking a short hiatus.  The
  896. next issue will be either March or April.  All current subscribers and
  897. advertisers will get automatic extensions so as not lose any issues.
  898.  
  899. Xplain will be using a combination of existing and new staff to provide even
  900. better services to the Macintosh Developer community.  In future issues, the
  901. magazine will address an even broader range of programmers, and development
  902. topics.  Among the changes will be increased development-related product
  903. reviews and far greater reader feedback.
  904. ****
  905.  
  906. This was part of a very courteous reply I received from Neil Ticktin,
  907. president of Xplain, in response to a message I sent to their AppleLink
  908. address. I was told that they know of a problem with some international
  909. subscribers not getting their November issues, and that they were sorting
  910. this out.
  911.  
  912. For those looking to get in touch with MacTutor, here's the new contact
  913. information:
  914.  
  915.     MacTutor Magazine
  916.     P.O. Box 250001
  917.     Los Angeles, CA 90025-250001
  918.     Voice: 310-575-4343
  919.     Fax: 310-575-0925
  920.     AppleLink: MACTUTOR
  921.     (via Internet: mactutor@applelink.apple.com)
  922.  
  923. (By the way, is that ZIP code number really correct?? I thought they only
  924. went up to 9 digits...) According to the message, they "love" AppleLink,
  925. and they're obviously not averse to responding to Internet mail messages
  926. either. They're also promising earlier deliveries in future.
  927.  
  928. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  929. Computer Services Dept                     fax: +64-7-838-4066
  930. University of Waikato            electric mail: ldo@waikato.ac.nz
  931. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  932. X Windows: distributed computing in reverse.
  933.  
  934.  
  935.  
  936. - -------------------------
  937.  
  938. From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
  939. Subject:  Status of MacTutor
  940. Date: 30 Jan 92 17:01:59 +1300
  941. Organization: University of Waikato, Hamilton, New Zealand
  942.  
  943. An update to my message about MacTutor: I just received a mail message
  944. saying the post office has decided to change their P O box number!
  945.  
  946. Here's the new contact information:
  947.  
  948.     MacTutor Magazine/Xplain Corp.
  949.     P.O. Box 250055
  950.     Los Angeles, CA 90025-250055
  951.     Voice: 310-575-4343
  952.     Fax: 310-575-0925
  953.     AppleLink: MACTUTOR
  954.  
  955. Lawrence D'Oliveiro                       fone: +64-7-856-2889
  956. Computer Services Dept                     fax: +64-7-838-4066
  957. University of Waikato            electric mail: ldo@waikato.ac.nz
  958. Hamilton, New Zealand    37^ 47' 26" S, 175^ 19' 7" E, GMT+13:00
  959. X Windows: distributed computing in reverse.
  960.  
  961.  
  962.  
  963. ---------------------------
  964.  
  965. From: trognoh@mist.CS.ORST.EDU (Herve Trognon)
  966. Subject: drawing dash lines in QuickDraw...
  967. Date: 28 Jan 92 01:43:04 GMT
  968. Organization: Oregon State University, Computer Science Dept.
  969.  
  970. Hello,
  971.  
  972. Is there any way to draw a dash line in quickdraw or do we have to implement it ourselves - and then how?           
  973.  
  974. Thanks
  975. Gribouille.
  976.  
  977.  
  978.  
  979. - -------------------------
  980.  
  981. From: alana@sisters.cs.uoregon.edu (Thomas Alan Akins)
  982. Subject:  drawing dash lines in QuickDraw...
  983. Organization: /local/lib/rn/organization
  984. Date: Tue, 28 Jan 1992 05:46:50 GMT
  985.  
  986. After pouring over Inside Macintosh, I couldn't find any Toolbox routines that
  987. draw dashed lines.  The SRGP package does have:
  988.  
  989.     SRGP_setLineStyle(lineStyleType);
  990.  
  991.     where lineStyleType = {CONTINUOUS, DASHED, DOTTED, DOT_DASHED}
  992.  
  993. But, for your own purposes, Inside Mac says you can override the built-in low-
  994. level line drawing routine with one of your own.  You therefore need to come up
  995. with a routine that will turn on pixels for a certain number of pixels (PenMode
  996. set to patCopy or 8) and then draws without turning on pixels (PenMode set to a
  997. negative number).
  998.  
  999. In order to use this routine as a standard (ie override the Toolbox StdLine
  1000. routine.) StdLine(newPt: Point) draws to the point specified by newPt.
  1001. Your routine could take other arguments (line the SRGP routine) to specify
  1002. the line style.  Or have a series of routines for each line style and use 
  1003. SetStdProcs(VAR procs: QDProcs) where:
  1004.  
  1005.     QDProcs = RECORD
  1006.             textProc:    Ptr; {text drawing}
  1007.             lineProc:    Ptr; {line drawing}
  1008.                 <blah>
  1009.                   .
  1010.                   .
  1011.  
  1012.     Change the lineProc pointer to point to the line-drawing routine you
  1013. need to draw the line style of your choice.
  1014.  
  1015. There are a lot of possibilities, most of which involve a good deal of
  1016. programming on your part.
  1017.  
  1018. If anyone else has better ideas (I know there are much better ideas) please
  1019. post them as I am quite the novice to Mac programming and would love to find
  1020. some shortcuts for this kind of thing.
  1021.                             _    _
  1022. -- 
  1023. *                                            Alan Akins                      *
  1024. *       "I could say 'addition'              alana@cs.uoregon.edu            *
  1025. *        when I mean ... 'basketball.'"      University of Oregon            *
  1026. *                        - E. Tick           Department of Computer Science  *
  1027.  
  1028.  
  1029.  
  1030. - -------------------------
  1031.  
  1032. From: rickert@cco.caltech.edu (Keith Warren Rickert)
  1033. Subject:  drawing dash lines in QuickDraw...
  1034. Date: 28 Jan 92 06:53:36 GMT
  1035. Organization: California Institute of Technology, Pasadena
  1036.  
  1037. In article <1992Jan28.054650.5707@cs.uoregon.edu> alana@sisters.cs.uoregon.edu (Thomas Alan Akins) writes:
  1038. >After pouring over Inside Macintosh, I couldn't find any Toolbox routines that
  1039. >draw dashed lines.  The SRGP package does have:
  1040. >
  1041. >    SRGP_setLineStyle(lineStyleType);
  1042. >
  1043. >    where lineStyleType = {CONTINUOUS, DASHED, DOTTED, DOT_DASHED}
  1044. >
  1045. >But, for your own purposes, Inside Mac says you can override the built-in low-
  1046. >level line drawing routine with one of your own.  You therefore need to come up
  1047. >with a routine that will turn on pixels for a certain number of pixels (PenMode
  1048. >set to patCopy or 8) and then draws without turning on pixels (PenMode set to a
  1049. >negative number).
  1050. >
  1051. >In order to use this routine as a standard (ie override the Toolbox StdLine
  1052. >routine.) StdLine(newPt: Point) draws to the point specified by newPt.
  1053. >Your routine could take other arguments (line the SRGP routine) to specify
  1054. >the line style.  Or have a series of routines for each line style and use 
  1055. >SetStdProcs(VAR procs: QDProcs) where:
  1056. >
  1057. >    Change the lineProc pointer to point to the line-drawing routine you
  1058. >need to draw the line style of your choice.
  1059. >
  1060. >There are a lot of possibilities, most of which involve a good deal of
  1061. >programming on your part.
  1062. >
  1063. >If anyone else has better ideas (I know there are much better ideas) please
  1064. >post them as I am quite the novice to Mac programming and would love to find
  1065. >some shortcuts for this kind of thing.
  1066. >                            _    _
  1067. >-- 
  1068. The quick and dirty trick that only works well for vertical or horizontal
  1069. lines is to set the pen pattern to one of the grays (depending on the 
  1070. pattern you want).  In my applications, I've only needed dashed lines
  1071. for vertical or horizontal lines so this works ok.  But if you need lines
  1072. on arbitrary angles or curves, it will work pretty poorly.  Mostly this
  1073. might be needed in drawing, graphing or charting type of programs as far
  1074. as I can think of right now. (Depending on the pattern, this might work
  1075. ok for some angles.  Also, regularly changing patterns to different offset
  1076. grays can give the effect seen in the MacPaint marquee among many others...
  1077. Hope this is of help to someone.
  1078. Keith
  1079. keith@imppig.caltech.edu
  1080. rickert@cco.caltech.edu 
  1081.  
  1082.  
  1083.  
  1084. - -------------------------
  1085.  
  1086. From: jess@gn.ecn.purdue.edu (Jess M Holle)
  1087. Subject:  drawing dash lines in QuickDraw...
  1088. Date: 29 Jan 92 04:07:36 GMT
  1089. Organization: Purdue University Engineering Computer Network
  1090.  
  1091. If this is just for screen display and just for lines, then it should be
  1092. possible to have a special Dotted_Line routine that draws the line as a
  1093. series of segments, with the endpoints of each line segment calculated by
  1094. the routine.  This would allow a parameter to the routine to specify the
  1095. length of each dash and the length of each blank desired.  I'm sure that
  1096. there are problems with this technique (esp. for printing), but for
  1097. onscreen lines, it should work.
  1098.  
  1099. Jess Holle
  1100.  
  1101.  
  1102.  
  1103. - -------------------------
  1104.  
  1105. From: Michael_Hecht@mac.sas.com (Michael Hecht)
  1106. Subject:  drawing dash lines in QuickDraw...
  1107. Date: 29 Jan 92 14:57:42 GMT
  1108. Organization: SAS Institute Inc.
  1109.  
  1110. In article <1992Jan28.014304.15010@CS.ORST.EDU>, trognoh@mist.CS.ORST.EDU
  1111. (Herve Trognon) asks:
  1112. > Is there any way to draw a dash line in quickdraw or do we have to
  1113. > implement it ourselves - and then how?           
  1114.  
  1115. In article <1992Jan28.065336.13637@cco.caltech.edu>, rickert@cco.caltech.edu
  1116. (Keith Warren Rickert) answers:
  1117. > The quick and dirty trick that only works well for vertical or horizontal
  1118. > lines is to set the pen pattern to one of the grays (depending on the 
  1119. > pattern you want).  In my applications, I've only needed dashed lines
  1120. > for vertical or horizontal lines so this works ok.  But if you need lines
  1121. > on arbitrary angles or curves, it will work pretty poorly.
  1122.  
  1123. When I had to do this, I used a combination of two patterns. Each pattern
  1124. was a 4-pixel-wide stripe at opposite orientations, like so:
  1125.  
  1126.     P1:  *....***    P2:  ***....*
  1127.          **....**         **....**
  1128.          ***....*         *....***
  1129.          ****....         ....****
  1130.          .****...         ...****.
  1131.          ..****..         ..****..
  1132.          ...****.         .****...
  1133.          ....****         ****....
  1134.  
  1135. Since we're drawing line segments, we can calculate the slope of the line and
  1136. choose the appropriate pattern accordingly, like so:
  1137.  
  1138.  
  1139. void DashedLine( short h, short v )
  1140. {
  1141.     short dashPatID;
  1142.  
  1143.  
  1144.     /* Look at the slope by combining signs of h and v:
  1145.         same sign means negative slope;
  1146.         different signs means positive slope
  1147.         (remember: the Y axis is reversed from normal Cartesian in Mac grafPort)
  1148.     */
  1149.     dashPatID = ( h ^ v ) > 0 ? P2 : P1;
  1150.  
  1151.     /* Draw the line segment using the appropriate pattern */
  1152.     PenPat( *GetPattern( dashPatID ));
  1153.     Line( h, v );
  1154. }
  1155.  
  1156.  
  1157. If you're drawing a curve as a sequence of line segments, this method is quite
  1158. acceptable, since the appropriate pattern is chosen independently for each seg-
  1159. ment.
  1160.  
  1161. I've also supplemented this QuickDraw method with a PostScript method that gets
  1162. used when printing. In PostScript, I collect a series of line segments to form
  1163. a path, which I can then draw in a single stroke using the DashedLine PicComment.
  1164. The PicComments are arranged such that when printing to a PostScript printer,
  1165. the PS method is used and the above QD method is used when drawing to the screen
  1166. or to a QuickDraw printer.
  1167.  
  1168. If anyone wants a copy of the PostScript snippet, just send me mail.
  1169.  
  1170. --Michael
  1171.  
  1172. =======================================================================
  1173. Michael P. Hecht                 | Internet:  Michael_Hecht@mac.sas.com
  1174. SAS Institute Inc.; Cary, NC USA | AppleLink: SAS.HECHT
  1175.  
  1176.  
  1177.  
  1178. - -------------------------
  1179.  
  1180. Subject:  drawing dash lines in QuickDraw...
  1181. From: jmatthews@desire.wright.edu
  1182. Date: 29 Jan 92 00:12:49 EST
  1183. Organization: Wright State University 
  1184.  
  1185. In article <1992Jan28.054650.5707@cs.uoregon.edu>, alana@sisters.cs.uoregon.edu (Thomas Alan Akins) writes:
  1186. > [concerning drawing dashed lines]
  1187. > There are a lot of possibilities, most of which involve a good deal of
  1188. > programming on your part.
  1189. > If anyone else has better ideas (I know there are much better ideas) please
  1190. > post them as I am quite the novice to Mac programming and would love to find
  1191. > some shortcuts for this kind of thing.
  1192.  
  1193. I wouldn't claim it's better, but drawing lines with a vertically or
  1194. horizontally stripped pattern works well (for horizontal or vertical lines,
  1195. respectively).
  1196.  
  1197. o----------------------------------------------------------------------------o
  1198. | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
  1199. | "I'm a commensal .sig virus, indistinguishable from an ordinary organelle."|
  1200. o----------------------------------------------------------------------------o
  1201.  
  1202.  
  1203.  
  1204.  
  1205. ---------------------------
  1206.  
  1207. From: greeny@top.cis.syr.edu (Jonathan Greenfield)
  1208. Subject: Finding all mounted volumes
  1209. Date: 28 Jan 92 02:36:29 GMT
  1210. Organization: CIS Dept., Syracuse University
  1211.  
  1212. How does one go about constructing a list of of all currently mounted
  1213. volumes?  (By vRefNum would be most convenient...but I can always convert
  1214. back to that.)
  1215.  
  1216. I'm interested in being able to search all of the desktop databases for
  1217. mounted volumes.  This is for System 7.
  1218.  
  1219. Thanks.
  1220.  
  1221. --
  1222. greeny                                           greeny@top.cis.syr.edu
  1223.  
  1224. "What's the difference between an orange?"
  1225.  
  1226.  
  1227.  
  1228. - -------------------------
  1229.  
  1230. From: engber@ils.nwu.edu (Mike Engber)
  1231. Subject:  Finding all mounted volumes
  1232. Date: 28 Jan 92 14:06:08 GMT
  1233. Organization: The Institute for the Learning Sciences
  1234.  
  1235. >I'm interested in being able to search all of the desktop databases for
  1236. >mounted volumes.  This is for System 7.
  1237.  
  1238. Here's a code frag (THINK C) that loops through all the volumes that
  1239. have DeskTop databases.
  1240.  
  1241. -ME
  1242.  
  1243. - -
  1244.  
  1245. /* Calls VPurgeDTDB for all mounted volumes */
  1246. static OSErr PurgeDTDB(OSType creator){
  1247.     VCB*    vcbPtr      = (VCB*)VCBQHdr.qHead;
  1248.     short   purgeCount  = 0;
  1249.  
  1250.     while(vcbPtr){
  1251.         OSErr                   err;
  1252.         HParamBlockRec          pb;
  1253.         GetVolParmsInfoBuffer   vParms;
  1254.  
  1255.         pb.ioParam.ioNamePtr    = NULL;
  1256.         pb.ioParam.ioVRefNum    = vcbPtr->vcbVRefNum;
  1257.         pb.ioParam.ioBuffer     = (Ptr)&vParms;
  1258.         pb.ioParam.ioReqCount   = sizeof(vParms);
  1259.         if(!PBHGetVolParmsSync(&pb) && ((1L<<bHasDesktopMgr) & vParms.vMAttrib)){
  1260.             switch(err=VPurgeDTDB(vcbPtr->vcbVRefNum,creator)){
  1261.                 case noErr:
  1262.                     ++purgeCount;
  1263.                     break;
  1264.                 case wPrErr:
  1265.                 case vLckdErr:
  1266.                     /* vol locked - no worry - ignore */
  1267.                     break;
  1268.                 default:
  1269.                     return err;
  1270.             }
  1271.         }
  1272.         vcbPtr = (VCB*)vcbPtr->qLink;
  1273.     }
  1274.     return purgeCount>0 ? noErr : -1;
  1275. }
  1276.  
  1277.  
  1278.  
  1279. - -------------------------
  1280.  
  1281. From: jmatthews@desire.wright.edu
  1282. Subject:  Finding all mounted volumes
  1283. Date: 29 Jan 92 05:02:40 GMT
  1284. Organization: Wright State University
  1285.  
  1286. In article <1992Jan27.213629.16075@newstand.syr.edu>, greeny@top.cis.syr.edu (Jonathan Greenfield) writes:
  1287. > How does one go about constructing a list of of all currently mounted
  1288. > volumes?  (By vRefNum would be most convenient...but I can always convert
  1289. > back to that.)
  1290.  
  1291. Here's an XCMD that collects a list of mounted volumes:
  1292. unit GetVolUnit;
  1293. interface
  1294.   uses
  1295.     HyperXCmd;
  1296.  
  1297.   procedure Main (paramPtr: XCmdPtr);  {the entry point for the XCMD/XFCN}
  1298.  
  1299. implementation
  1300.  
  1301.   procedure Main (paramPtr: XCmdPtr);
  1302.  
  1303.     procedure GetVol (paramPtr: XCmdPtr);
  1304.       var
  1305.         err: OSErr;
  1306.         index: Integer;
  1307.         nameList: Handle;
  1308.         myHPB: HParamBlockRec;
  1309.         vName: Str255;
  1310.  
  1311.       procedure Fail (errMsg: Str255); {return an error message to HyperCard}
  1312.       begin {Fail}
  1313.         paramPtr^.returnValue := PasToZero(paramPtr, errMsg);
  1314.         Exit(GetVol);
  1315.       end; {Fail}
  1316.  
  1317.       procedure PutName (s: Str255); {add 's' to the nameList}
  1318.       begin {PutName}
  1319.         if PtrAndHand(pointer(ord(@s) + 1), nameList, length(s)) <> noErr then
  1320.           Fail('GetVol: out of memory')
  1321.       end; {PutName}
  1322.  
  1323.     begin {GetVol}
  1324.       if (paramPtr^.paramCount <> 0) then  {no parameters required}
  1325.         Fail('GetVol: no parameters required');
  1326.       nameList := NewHandle(0);
  1327.       if nameList = nil then
  1328.         Fail('GetVol: out of memory');
  1329.       index := 1;
  1330.       with myHPB do
  1331.         repeat
  1332.           ioNamePtr := @vName;
  1333.           ioVolIndex := index;
  1334.           err := PBHGetVInfo(@myHPB, false);
  1335.           if err = noErr then
  1336.             PutName(concat(vName, chr(13)));
  1337.           index := succ(index);
  1338.         until err <> noErr;
  1339.       PutName(chr(0)); {terminate list}
  1340.       paramPtr^.passFlag := false;
  1341.       paramPtr^.returnValue := nameList
  1342.     end; {GetVol}
  1343.  
  1344.   begin {Main}
  1345.     GetVol(paramPtr) {entry point}
  1346.   end; {Main}
  1347.  
  1348. end. {implementation}
  1349.  
  1350. The essential technique is indexed calls to PBHGetVInfo(). Hope this helps.
  1351.  
  1352. o----------------------------------------------------------------------------o
  1353. | John B. Matthews, jmatthews@desire.wright.edu, disclaimer:= myViews <> WSU |
  1354. | "I'm a commensal .sig virus, indistinguishable from an ordinary organelle."|
  1355. o----------------------------------------------------------------------------o
  1356.  
  1357.  
  1358.  
  1359. ---------------------------
  1360.  
  1361. From: ggw@wolves.uucp (Gregory G. Woodbury)
  1362. Subject: 68040 caches, why do programs break?
  1363. Date: 28 Jan 92 05:02:35 GMT
  1364. Organization: Wolves Den UNIX
  1365.  
  1366. The latest version of ToDo! (3.1) is system 7 compatible, but will not
  1367. run with the Q900 caches turned on.  Since the machine is slower than
  1368. molasses in february on mt washington with the caches off, the program
  1369. isn't worth using on the Quadra.
  1370.  
  1371. I'm told that the problem is that certain compilers (pascal generally)
  1372. try to be smart and generate what is essentially self-modifying code
  1373. that don't work with the 040 large caches.  It seems stupid to me that
  1374. any compiler would generate such a sequence.  Am I being uncharitable?
  1375.  
  1376. I'm also feeling a little dense :-)  are there other code constructs
  1377. that will break on a cache?
  1378. -- 
  1379. Gregory G. Woodbury @ The Wolves Den UNIX, Durham NC
  1380. UUCP: ...dukcds!wolves!ggw   ...duke!wolves!ggw           [use the maps!]
  1381. Domain: ggw@cds.duke.edu     ggw%wolves@duke.cs.duke.edu
  1382. [The line eater is a boojum snark! ]           <standard disclaimers apply>
  1383.  
  1384.  
  1385.  
  1386. - -------------------------
  1387.  
  1388. From: steveh@tasman.cc.utas.edu.au (Steve Howell)
  1389. Subject:  68040 caches, why do programs break?
  1390. Date: 28 Jan 92 12:31:02 GMT
  1391. Organization: University of Tasmania, Australia.
  1392.  
  1393. ggw@wolves.uucp (Gregory G. Woodbury) writes:
  1394.  
  1395. >The latest version of ToDo! (3.1) is system 7 compatible, but will not
  1396. >run with the Q900 caches turned on.  Since the machine is slower than
  1397. >molasses in february on mt washington with the caches off, the program
  1398. >isn't worth using on the Quadra.
  1399.  
  1400. Add to that list Microsoft Word 4 (and 5, from the looks of things) and
  1401. PageMaker, to name just a few...
  1402.  
  1403. >I'm told that the problem is that certain compilers (pascal generally)
  1404. >try to be smart and generate what is essentially self-modifying code
  1405. >that don't work with the 040 large caches. 
  1406.  
  1407. Why would self-modifying code cause a problem? As I understand it, the 68040
  1408. supports both the write-through and copy-back cache architectures. In either 
  1409. case, bus "snooping" should detect an access to main ram and mark the out-dated
  1410. cache entry as invalid, forcing the new data to be read from main ram into the 
  1411. cache.  Is that not the case? (BTW, I agree that the generation of self-
  1412. modifying code is a dubious practice at best...)
  1413.  
  1414. Just curious.
  1415. Tim. (c/o:- steveh@tasman.cc.utas.edu.au)
  1416.  
  1417.  
  1418.  
  1419. - -------------------------
  1420.  
  1421. From: bgr@hawk.owlnet.rice.edu (Robert Glen Rhode)
  1422. Subject:  68040 caches, why do programs break?
  1423. Date: 28 Jan 92 14:27:19 GMT
  1424. Organization: Rice University
  1425.  
  1426. In article <1992Jan28.050235.25172@wolves.uucp>, ggw@wolves.uucp (Gregory G. Woodbury) writes:
  1427. > I'm told that the problem is that certain compilers (pascal generally)
  1428. > try to be smart and generate what is essentially self-modifying code
  1429. > that don't work with the 040 large caches.  It seems stupid to me that
  1430. > any compiler would generate such a sequence.  Am I being uncharitable?
  1431. > I'm also feeling a little dense :-)  are there other code constructs
  1432. > that will break on a cache?
  1433.  
  1434. Let me add another log to the fire here:
  1435. How can any "correct" cache coherency protocol allow the cache to
  1436. operate in any way which is different from non-cached?  Suppose you
  1437. have a program that, yes, modifies itself.  So the cache line that
  1438. got modified sets its "dirty" bit.  If you access it soon, it's still
  1439. in the cache.  If that cache line gets replaced, then the dirty bit
  1440. should be read, and that cache line should be written to memory.
  1441. This should all be done in hardware.  So where does the problem occur?
  1442.  
  1443. Just curious.
  1444.  
  1445. - Bob who will never be able to afford a 68040 anyway
  1446.  
  1447.  
  1448.  
  1449. - -------------------------
  1450.  
  1451. From: davoli@natinst.com (Russell J. Davoli)
  1452. Subject:  68040 caches, why do programs break?
  1453. Date: 28 Jan 92 15:21:50 GMT
  1454. Organization: National Instruments Corp.
  1455.  
  1456. In article <1992Jan28.142719.5503@rice.edu>, bgr@hawk.owlnet.rice.edu (Robert Glen Rhode) writes:
  1457. > In article <1992Jan28.050235.25172@wolves.uucp>, ggw@wolves.uucp (Gregory G. Woodbury) writes:
  1458. > > 
  1459. > > I'm told that the problem is that certain compilers (pascal generally)
  1460. > > try to be smart and generate what is essentially self-modifying code
  1461. > > that don't work with the 040 large caches.  It seems stupid to me that
  1462. > > any compiler would generate such a sequence.  Am I being uncharitable?
  1463. > > 
  1464. > How can any "correct" cache coherency protocol allow the cache to
  1465. > operate in any way which is different from non-cached?  Suppose you
  1466. > have a program that, yes, modifies itself.  So the cache line that
  1467. > got modified sets its "dirty" bit.  If you access it soon, it's still
  1468. > in the cache.  If that cache line gets replaced, then the dirty bit
  1469. > should be read, and that cache line should be written to memory.
  1470. > This should all be done in hardware.  So where does the problem occur?
  1471.  
  1472. The problem arises from the 68040 having big and separate data and code caches
  1473. that are copyback rather than write-through. When a program modifies code, say
  1474. in a jump table, the move instruction modifies a data word in the data cache.
  1475. However, if the program now tries to execute that code and the data hasn't
  1476. been written back to memory, then the instruction is fetched from memory
  1477. that hasn't been updated with the new code.  At this point, the CPU is
  1478. executing the wrong code, and probably no real code at all in the case of
  1479. a jump table.
  1480.  
  1481. It seems like it would have been helpful to tie the cache addresses in both
  1482. caches together in some so the 68040 would know when to flush the caches at
  1483. least, but this could be very expensive because each cache is 4K I think.
  1484.  
  1485. Before you flame Motorola, there may be a good justification for this.  In
  1486. UNIX systems, I don't believe that code is allowed to modify itself.  The
  1487. separate caches would be a boon here and wouldn't cause any problems.
  1488.  
  1489. --Russell Davoli (davoli@natinst.com)
  1490.  
  1491.  
  1492.  
  1493. - -------------------------
  1494.  
  1495. From: J.Cook@ENS.Prime.COM (Jim Cook)
  1496. Subject:  68040 caches, why do programs break?
  1497. Date: 28 Jan 92 16:39:10 GMT
  1498. Organization: Prime Computer, Inc.
  1499.  
  1500. In article <31832@natinst.natinst.com> davoli@natinst.com (Russell J. Davoli)
  1501. writes:
  1502. >In article <1992Jan28.142719.5503@rice.edu>, bgr@hawk.owlnet.rice.edu (Robert
  1503. Glen Rhode) writes:
  1504. >> 
  1505. >> In article <1992Jan28.050235.25172@wolves.uucp>, ggw@wolves.uucp (Gregory G.
  1506. Woodbury) writes:
  1507. >> > 
  1508. >> > I'm told that the problem is that certain compilers (pascal generally)
  1509. >> > try to be smart and generate what is essentially self-modifying code
  1510. >> > that don't work with the 040 large caches.  It seems stupid to me that
  1511. >> > any compiler would generate such a sequence.  Am I being uncharitable?
  1512. >> > 
  1513. >> How can any "correct" cache coherency protocol allow the cache to
  1514. >> operate in any way which is different from non-cached?  Suppose you
  1515. >> have a program that, yes, modifies itself.  So the cache line that
  1516. >> got modified sets its "dirty" bit.  If you access it soon, it's still
  1517. >> in the cache.  If that cache line gets replaced, then the dirty bit
  1518. >> should be read, and that cache line should be written to memory.
  1519. >> This should all be done in hardware.  So where does the problem occur?
  1520. >
  1521. >The problem arises from the 68040 having big and separate data and code caches
  1522. >that are copyback rather than write-through. When a program modifies code, say
  1523. >in a jump table, the move instruction modifies a data word in the data cache.
  1524. >However, if the program now tries to execute that code and the data hasn't
  1525. >been written back to memory, then the instruction is fetched from memory
  1526. >that hasn't been updated with the new code.  At this point, the CPU is
  1527. >executing the wrong code, and probably no real code at all in the case of
  1528. >a jump table.
  1529.  
  1530. There is also another problem.  Storing to memory invalidates the data cache
  1531. but does not invalidate the instruction cache.  This means that even if the
  1532. modified instruction has actually made it out of the cache/write buffer to
  1533. memory, if the instruction to be executed is in the instruction cache, we
  1534. will take the stale entry out of the instruction cache rather than the most
  1535. current valid copy now in memory.  Again, the lack of tracking between stores
  1536. to memory needing to invalidate the instruction cache was a concious decision
  1537. to simplify the design, reduce the amount of circuitry, and increase 
  1538. the performance of the 68040.  A lot of super-mini's and larger machines have
  1539. this limitation.  It's now migrating its way into micro's.
  1540.  
  1541. Jim
  1542. <J.Cook@ENS.Prime.COM>
  1543.  
  1544.  
  1545.  
  1546. - -------------------------
  1547.  
  1548. From: siegel@world.std.com (Rich Siegel)
  1549. Subject:  68040 caches, why do programs break?
  1550. Date: 28 Jan 92 18:33:04 GMT
  1551. Organization: Symantec Language Products Group
  1552.  
  1553. In article <1992Jan28.050235.25172@wolves.uucp> ggw@cds.duke.edu writes:
  1554.  
  1555. >I'm told that the problem is that certain compilers (pascal generally)
  1556. >try to be smart and generate what is essentially self-modifying code
  1557. >that don't work with the 040 large caches.  It seems stupid to me that
  1558. >any compiler would generate such a sequence.  Am I being uncharitable?
  1559.  
  1560.     Not really uncharitable, just misinformed. These days, no Macintosh
  1561. compiler generates self-modifying code sequences from high-level code. There
  1562. are occasions when programmers write such code sequences in assembly language,
  1563. and these will break when the 68040 caches are in copy-back mode, because the
  1564. code that's been modified in memory isn't in sync with the code that's in
  1565. the 040's instruction pipeline, so when the copyback happens, the modified
  1566. code gets smashed.
  1567.  
  1568.     There are some spots where "in-the-pipeline" code modification is
  1569. essential - for example, in the Mac Segment Loader, which virtually every
  1570. application uses. In the segment loader, code at the potential return
  1571. address (in the jump table) is modified, and it's necessary to flush the
  1572. cache before proceeding.
  1573.  
  1574.     Older versions of THINK C and THINK Pascal had a homegrown segment
  1575. loader for supporting multi-segmented code resources, drivers, and DAs, so
  1576. any segmented DA, driver, or code resource written with these (out-of-date)
  1577. versions will probably not work with the copyback cache.
  1578.  
  1579.     In a nutshell: any current 040 cache problems are likely to be the
  1580. result of code written in assembly language, not generated by a compiler.
  1581.  
  1582. R.
  1583.  
  1584.  
  1585. -- 
  1586. - ---------------------------------------------------------------------
  1587. Rich Siegel                              Internet: siegel@world.std.com
  1588. Senior Software Engineer                 Applelink: SIEGEL
  1589. Symantec Languages Group
  1590.  
  1591.  
  1592.  
  1593. ---------------------------
  1594.  
  1595. End of C.S.M.P. Digest
  1596. **********************
  1597.